//<script>
$(document).ready(function() {
    insert_index = 0;

// add new group
    $('.list_form .add_field_button').click(function(){
        var container = $('#groupes');
        var content = '<tr class="t_groupe-'+insert_index+'">';
        // Inputs for insert here
        content += '<td>?</td><td>';
        content += '<input type="text" name="elements_insert['+insert_index+'][titre]" value="" style="width: 270px;" />';
        content += '</td><td>&nbsp;</td>';
        content += '<td><a href="javascript:;" class="t_delete_link"><?php echo(_T('ecatalogue:delete')); ?></a></td>';
        content += '</tr>';

        insert_index++;
        container.append(content);
    });

// delete group
    $('.list_form .delete_link').live('click', function(){
        if (confirm('<?php echo(_T('ecatalogue:delete_element')); ?> "' + $(this).parent().parent().find('input').val() + '"?')) {                
            var element_id = $(this).attr('data-element-id');
            if (element_id!=undefined) {                                     
                $('.list_form').append('<input type="hidden" name="elements_delete['+element_id+']" value="'+element_id+'" />');    
            }
            $(this).parent().parent().remove();    
        }                
    });
});
//</script>